home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / leocom.zip / LEOCOM.H < prev    next >
C/C++ Source or Header  |  1991-08-03  |  4KB  |  94 lines

  1. /******************************************************************************
  2.  * Communications Routines for the IBM PC and compatables                     *
  3.  *                                                                            *
  4.  * Supporting any combination of IRQ and base address, speeds up to 38,400    *
  5.  * BPS.                                                                       *
  6.  *                                                                            *
  7.  * (C) Copyright 1991 by Leo Bicknell, All Rights Reserved.  Duplication of   *
  8.  * this source code in any form, in whole or in part, without written         *
  9.  * permition from the author is expressly prohibited                          *
  10.  *                                                                            *
  11.  ***************************** Revision History *******************************
  12.  *                                                                            *
  13.  * 07/07/91  - Origional write finished;                                      *
  14.  *            Leo Bicknell                                                    *
  15.  *                                                                            *
  16.  * 08/02/91  - Fixup for distribution                                         *
  17.  *                                                                            *
  18.  ******************************************************************************/
  19.  
  20. #ifndef LEOCOM
  21. #define LEOCOM
  22.  
  23. #define DATA8       0x03            /* 8 Data bits */
  24. #define DATA7       0x02            /* 7 Data bits */
  25. #define DATA6       0x01            /* 6 Data bits */
  26. #define DATA5       0x00            /* 5 Data bits */
  27.  
  28. #define STOP2       0x04            /* 2 Stop Bits */
  29. #define STOP1       0x00            /* 1 Stop Bit */
  30.  
  31. #define PNONE       0x00            /* No Parity */
  32. #define PODD        0x08            /* Odd Parity */
  33. #define PEVEN       0x18            /* Even Parity */
  34.  
  35. /* Baud Rate Divisors */
  36. #define BAUD300     384
  37. #define BAUD1200    96
  38. #define BAUD2400    48
  39. #define BAUD9600    12
  40. #define BAUD1920    6
  41. #define BAUD3840    3
  42.  
  43. #define IM4        ~0x10            /* Interrupt Mask, bit 4 (IRQ4, COM1) */
  44. #define IM3        ~0x08            /* Interrupt Mask, bit 3 (IRQ3, COM2) */
  45.  
  46. #ifndef TRUE
  47. #define TRUE    1
  48. #define FALSE   0
  49. #define HIGH    TRUE
  50. #define LOW     FALSE
  51. #endif
  52.  
  53.  
  54. /* Macro Prototypes */
  55. int     mkbhit(void);
  56. int     mdcd(void);
  57. int     mcts(void);
  58. int     mdsr(void);
  59.  
  60. /* Macros */
  61. #define mkbhit()    (bufcount?TRUE:FALSE)
  62. #define mdcd()      ((modemstatus&DCD)?TRUE:FALSE)
  63. #define mcts()      ((modemstatus&CTS)?TRUE:FALSE)
  64. #define mdsr()      ((modemstatus&DSR)?TRUE:FALSE)
  65.  
  66.  
  67. /* Public varable definitions */
  68.  
  69. extern  volatile    int         breakcount;
  70. extern  volatile    int         framingcount;
  71. extern  volatile    int         paritycount;
  72. extern  volatile    int         overruncount;
  73. extern  volatile    char        breakchange;
  74. extern  volatile    char        framingchange;
  75. extern  volatile    char        paritychange;
  76. extern  volatile    char        overrunchange;
  77. extern  volatile    int         modemstatus;
  78. extern  volatile    int         bufcount;
  79.  
  80. /* Prototypes for PUBLIC functions */
  81.  
  82. int         mprintf(char *c, ...);
  83. void        mclear(void);
  84. int         mclose(void);
  85. int         mopen(int baud, int word, int parity, int stop, int BASE, int VECTOR, int MASK);
  86. int         mputs(char *s);
  87. int         mputc(int c);
  88. int         mgetc(void);
  89. void        msdtr(int state);
  90. void        msrts(int state);
  91. void        msbreak(void);
  92.  
  93. #endif
  94.